﻿
/****** Object:  Table [dbo].[Calendar]    Script Date: 6/29/2013 8:39:42 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Calendar](
	[CalendarId] [int] IDENTITY(1,1) NOT NULL,
	[HouseSitterId] [int] NOT NULL,
	[PreferredLocation] [nvarchar](50) NOT NULL,
	[AccurateRangeStart] [date] NOT NULL,
	[AccurateRangeEnd] [date] NOT NULL,
	[CalendarRangeId] [int] NOT NULL,
 CONSTRAINT [PK_Calendar] PRIMARY KEY CLUSTERED 
(
	[CalendarId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Calendar]  WITH CHECK ADD  CONSTRAINT [FK_Calendar_CalendarRange] FOREIGN KEY([CalendarRangeId])
REFERENCES [dbo].[CalendarRange] ([CalendarRangeId])
GO

ALTER TABLE [dbo].[Calendar] CHECK CONSTRAINT [FK_Calendar_CalendarRange]
GO

ALTER TABLE [dbo].[Calendar]  WITH CHECK ADD  CONSTRAINT [FK_Calendar_HouseSitter] FOREIGN KEY([HouseSitterId])
REFERENCES [dbo].[HouseSitter] ([HouseSitterId])
GO

ALTER TABLE [dbo].[Calendar] CHECK CONSTRAINT [FK_Calendar_HouseSitter]
GO

